<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="cn.piaoyi.service.*" %>
<%@ page import="cn.piaoyi.bean.*" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="org.springframework.web.context.support.*"%> 
<%@ page import="org.springframework.context.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>test</title>
</head>
<body>
<%
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(pageContext.getServletContext());
OrderInfoService orderInfoService = (OrderInfoService)ctx.getBean("orderInfoService");
String action = request.getParameter("action");
if(StringUtils.isNotBlank(action)){
	if(action.equalsIgnoreCase("resume")){
		OrderInfo oi = orderInfoService.findOrderInfoById(1);
		oi.setOrderStatus(0);
		orderInfoService.updateOrderInfo(oi);
	}
	if(action.equalsIgnoreCase("test")){
		response.sendRedirect("/alipay_to.action?id=1");
	}
}else{
	OrderInfo oi = orderInfoService.findOrderInfoById(1);
	if(oi.getOrderStatus()==0){
		out.println("未付款");
	}
	if(oi.getOrderStatus()==1){
		out.println("已付款");
	}
	if(oi.getOrderStatus()==2){
		out.println("己发货");
	}
	if(oi.getOrderStatus()==3){
		out.println("己完成");
	}
}
%>
<br />
<a href="/testpay.jsp?action=resume">恢复状态</a><br />
<a href="/testpay.jsp?action=test">测试</a><br />
<a href="/testpay.jsp">查看</a><br />
</body>
</html>
